import SwiftUI

struct LocationCard: View {
    var image: Image
    var name: String
    var description: String
    var photoCount: Int
    var onTap: (() -> Void)? = nil
    
    var body: some View {
        HStack(spacing: 16) {
            image
                .resizable()
                .aspectRatio(1, contentMode: .fill)
                .frame(width: 60, height: 60)
                .clipped()
                .cornerRadius(12)
                .shadow(color: Color.black.opacity(0.08), radius: 4, x: 0, y: 2)
            VStack(alignment: .leading, spacing: 6) {
                Text(name)
                    .font(.system(size: 18, weight: .semibold))
                    .foregroundColor(.primary)
                Text(description)
                    .font(.subheadline)
                    .foregroundColor(.secondary)
                    .lineLimit(2)
                Text("\(photoCount) 张照片")
                    .font(.caption)
                    .foregroundColor(.accentColor)
            }
            Spacer()
        }
        .padding(14)
        .background(
            RoundedRectangle(cornerRadius: 18)
                .fill(Color(.systemBackground))
                .shadow(color: Color.black.opacity(0.04), radius: 8, x: 0, y: 2)
        )
        .contentShape(RoundedRectangle(cornerRadius: 18))
        .onTapGesture { onTap?() }
        .animation(.easeInOut(duration: 0.15), value: name)
    }
}

#Preview {
    LocationCard(image: Image(systemName: "mappin.and.ellipse"), name: "颐和园", description: "北京著名皇家园林", photoCount: 32)
        .padding()
        .frame(width: 320)
} 